#include "spl.includes.h"
#include "splib.h"

using namespace SPLib;
using namespace SPLib::Controls;
using namespace SPLib::Geom;
using namespace Gdip;

VOID  Label::onControlPaint(Controls::ControlPaintEvent& iEvent)
{
  PCTSTR wText = getText();

  iEvent.graphics.DrawString(
    wText, -1, font,
    rectToFloat(iEvent.bounds),
    format,
    &SolidBrush(foreColor));

  delete[] wText;
}

Label::Label()
{
  font      = NULL;
  format    = new Gdip::StringFormat;
  foreColor = 0xFF000000;

  format->SetAlignment(Gdip::StringAlignmentNear);
  format->SetLineAlignment(Gdip::StringAlignmentCenter);
  format->SetTrimming(Gdip::StringTrimmingEllipsisWord);
}
